<script setup lang="ts">
import { ref } from 'vue';
import MyTable from './coms/MyTable.vue';
const list = ref([
  { id: 1, name: '张小花', age: 18 },
  { id: 2, name: '孙大明', age: 19 },
  { id: 3, name: '刘德忠', age: 17 },
])

const onShowInfo=(item:any)=>{
  console.log(item)
}
</script>

<template>
  <div class="page">
    <MyTable :list="list">
      <template #default="item">
        <tr>
          <td>{{item.item.id}}</td>
          <td>{{item.item.name}}</td>
          <td>{{item.item.age}}</td>
          <td>
            <button @click="onShowInfo(item.item)">查看</button>
          </td>
        </tr>
      </template>
    </MyTable>
  </div>
</template>

<style lang="scss" scoped></style>
